﻿#ifndef RTC_AUDIO_FRAME_OBSERVER_H
#define RTC_AUDIO_FRAME_OBSERVER_H

#include <QObject>
#include <QMetaType>
#include "engine_interface.h"
#include "engine_types.h"

namespace ding::rtc {

class RTCAudioFrameObserver : public QObject, public RtcEngineAudioFrameObserver
{
    Q_OBJECT

public:
    explicit RTCAudioFrameObserver(QObject *parent = nullptr);
    ~RTCAudioFrameObserver();

    // 音频帧观察者接口实现
    void OnRemoteUserAudioFrame(const char *uid, RtcEngineAudioFrame &frame) override;
    void OnPlaybackAudioFrame(RtcEngineAudioFrame &frame) override;
    void OnCapturedAudioFrame(RtcEngineAudioFrame &frame) override;
    void OnProcessCapturedAudioFrame(RtcEngineAudioFrame &frame) override;
    void OnPublishAudioFrame(RtcEngineAudioFrame &frame) override;

    // 配置音频帧观察者
    void setEnabled(bool enabled);
    void setConfig(const RtcEngineAudioFrameObserverConfig &config);

signals:
    void audioFrameReceived(const QString &source, const RtcEngineAudioFrame &frame);

private:
    bool m_enabled;
    RtcEngineAudioFrameObserverConfig m_config;
};

} // namespace ding::rtc

// 注册自定义类型以支持Qt信号槽系统
Q_DECLARE_METATYPE(ding::rtc::RtcEngineAudioFrame)

#endif // RTC_AUDIO_FRAME_OBSERVER_H 